<template>
  <div class="basic_wrap">
    <div class="newTitle">
      <img src="@/assets/img/leftGray.png" class="backIcon" @click="$router.back()">
      <div class="title">集团简介</div>
    </div>
    <div class="cont">
      <div v-for="(item,index) in list" :key="index">
        <div v-if="item.show_type == 0">
          <div v-for="(it,ind) in item.data" :key="ind" class="type1" @click="toLink(it)">
            <img :src="it.img" alt="" class="type1Img">
          </div>
        </div>
        <div v-if="item.show_type == 1">
          <div class="type2">
             <div class="type2Item"  v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
               <div class="type2ItemTop">{{it.title}}</div>
               <div class="type2ItemBot">{{it.des}}</div>
               <img :src="it.img" class="type2ItemImg">
             </div>
          </div>
        </div>
        <div v-if="item.show_type == 2">
          <div class="type3">
            <div class="type3Item"  v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
               <div class="type3ItemTitle">{{it.title}}</div>
               <div class="type3Cont" v-html="it.content"></div>
            </div>
          </div>
        </div>
        <div v-if="item.show_type == 3">
          <div class="type4" v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
              {{it.title}}
          </div>
        </div>
        <div v-if="item.show_type == 4" >
          <div class="type5">
            <div class="type5Item" v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
              <div  class="type5Img">
                <img :src="it.img">
              </div>
              <div class="type5Title">
                {{it.title}}
              </div>
            </div>
          </div>
        </div>
        <div v-if="item.show_type == 5">
          <div class="type6">
            <div class="type6Item" v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
              <video :src="it.des" controls="controls">
                您的浏览器不支持 video 标签。
              </video>
            </div>
          </div>
        </div>
        <div v-if="item.show_type == 6">
          <div class="type7">
            <div class="type7Item" v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
               <div class="type7ItemLeft">
                 <img :src="it.img" alt="">
               </div>
              <div class="type7ItemRight">
                <div class="ty7Top">
                  {{it.title}}
                </div>
                <div class="ty7Bot">
                  {{it.des}}
                </div>
              </div>
            </div>
          </div>
        </div>
        <div v-if="item.show_type == 7">
          <div class="type8">
            <div class="type8tem" v-for="(it,ind) in item.data" :key="ind" @click="toLink(it)">
               <div class="type8temTitle">
                 {{it.title}}
               </div>
              <div class="type8Img">
                <img :src="it.img" alt="">
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue';
import Fetch from '../../utils/fetch'
import Clipboard from "v-clipboard";
import QRCode from 'qrcodejs2'
import {
  Icon,
  List,
  Empty,
  Popup
} from "vant";

Vue.use(Icon).use(Clipboard).use(List).use(Empty).use(Popup);
export default {
  name: "team",
  data() {
    return {
      page: 1,
      listRows: 8,
      list: [],
      keyword: ''
    };
  },
  created() {
    this.$parent.footer('user', false);
  },
  mounted() {
    this.onLoad()
  },
  methods: {
    toLink(item){
      if(item.link_url){
        this.$router.push({
          path: item.link_url
        });
      }
    },
    reduceList(objArray) {
      objArray.sort((a, b) => a.floor - b.floor);
// 生成多维数组
      const multiDimArray = [];
      let currentId = null;
      let currentArray = null;
      for (const obj of objArray) {
        if (obj.floor !== currentId) {
          currentId = obj.floor;
          currentArray = [];
          multiDimArray.push({
            floor: currentId,
            show_type: obj.show_type,
            data: currentArray
          });
        }
        currentArray.push(obj);
      }
      console.log(multiDimArray, 'multiDimArray')
      return multiDimArray
    },
    onLoad() {
      Fetch('/index/article_list', {
        page: 1,
        listRows: 100,
        type: 13
      }).then(r => {
        this.list = this.reduceList(r.data)
      });
    }
  },
};
</script>

<style lang="less" scoped>
.basic_wrap {
  background: linear-gradient(0deg, #F1FAFE 32%, #F1FAFE 100%);
  min-height: 100vh;
  width: 100vw;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
  .newTitle {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    .backIcon {
      position: absolute;
      top: 50%;
      left: 20px;
      transform: translate(-50%, -50%);
      width: 16px;
      height: 16px;
    }

    .title {
      font-size: 16px;
      font-weight: bold;
    }
  }
  .cont {
    padding: 0 16px;
    .type1 {
      margin-bottom: 16px;
      .type1Img {
        width: 91vw;
        height: 140px;
        object-fit: cover;
        border-radius: 8px;
      }
    }
    .type2{
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      margin-bottom: 10px;
      .type2Item{
        width: 44vw;
        height: 90px;
        background: #FFFFFF;
        margin-bottom: 7px;
        border-radius: 8px;
        box-sizing: border-box;
        padding-top: 27px;
        padding-left: 17px;
        position: relative;
        .type2ItemTop{
           margin-bottom: 10px;
        }
        .type2ItemBot{

        }
        .type2ItemImg{
          position: absolute;
          width: 60px;
          height: 60px;
          right: 0;
          bottom: 0;
        }
      }
    }
    .type3{
      .type3Item{
        .type3ItemTitle{
          font-size: 16px;
          font-weight: bold;
          margin-bottom: 10px;
          margin-top: 10px;
        }
        .type3Cont{

        }
      }
    }
    .type4{
      font-weight: bold;
      font-size: 16px;
      margin: 16px 0;
    }
    .type5{
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      .type5Item{
        display: flex;
        align-items: center;
        width: 44vw;
        height: 80px;
        background: #FFFFFF;
        margin-bottom: 7px;
        box-sizing: border-box;
        padding: 0 16px;
        border-radius: 8px;
        .type5Img{
          margin-right: 8px;
          img{
            width: 45px;
            height: 45px;
          }
        }
        .type5Title{

        }
      }
    }
    .type6{
      .type6Item{
        video{
          width: 100%;
          height: 195px;
        }
      }
    }
    .type7{
      .type7Item{
        background: #FFFFFF;
        display: flex;
        align-items: center;
        margin-bottom: 8px;
        border-radius: 8px;
        box-sizing: border-box;
        padding: 8px;
         .type7ItemLeft{
           margin-right: 16px;
           img{
              width: 60px;
              height: 60px;
           }
         }
        .type7ItemRight{
          .ty7Top{}
          .ty7Bot{
            text-align: right;
            color: #A3A3A3;
          }
        }
      }
    }
    .type8{
      .type8tem{
        .type8temTitle{
           font-size: 16px;
          font-weight: bold;
          text-align: center;
          margin: 16px 0;
        }
        .type8Img{
          img{
            width: 90vw;
            height: auto;
          }
        }
      }
    }
  }
}
</style>
